/**
 * @copyright Copyright (C) 2021 XH Technology Inc. All Rights Reserved
 * @file log_manage.h
 * @author Fan Junmin
 * @version  V1.0
 * @date  03/19/2021
 * @brief  日志管理模块，主要负责日志管理的初始化和销毁
*/

#ifndef __LOG_MANAGE_H__
#define __LOG_MANAGE_H__

#include <string>
#include "tools/m_mutex.h"
#include "tools/auto_guard.h"
#include "zlog/zlog.h"

#define log_error(format, ...)      dzlog_printf(ERROR, format, ##__VA_ARGS__)
#define log_warn(format, ...)       dzlog_printf(WARN, format, ##__VA_ARGS__)
#define log_info(format, ...)       dzlog_printf(INFO, format, ##__VA_ARGS__)
#define log_debug(format, ...)      dzlog_printf(DEBUG, format, ##__VA_ARGS__)

class Logger
{
public:
    static Logger* getInstance();

    void reload();

private:
    Logger();
    ~Logger();

private:
    static Logger*          instanceM;
    static MMutex           instanceLockM;

    static std::string      configM;
    static std::string      nameM;
    uint64_t                lastCheckTimeM;
    struct timespec         lastConfigTimeM;
};


#endif
